<?php

namespace app\model\not_del;

use think\Model;
use think\model\relation\HasMany;

/**
 * 量表类型
 */
class RatingScaleTypeModel extends Model
{
    protected $name = 'rating_scale_type';

    /**
     * 关联多个量表
     * @return HasMany
     */
    public function RatingScale(): HasMany
    {
        return $this->hasMany(RatingScaleModel::class, 'type_id')->where('status', 1);
    }

    /**
     * 关联多个量表-普通用户版
     * @return HasMany
     */
    public function IsSelfEvaluation(): HasMany
    {
        return $this->hasMany(RatingScaleModel::class, 'type_id')->where([
            ['status','=', 1],
            ['is_self_evaluation','=',1]
        ]);
    }
}